home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: confusion between putchar and printf
- Date: Tue, 12 Mar 96 01:06:28 GMT
- Organization: none
- Message-ID: <826592788snz@genesis.demon.co.uk>
- References: <4i1v2n$30o@news.azstarnet.com> <Do4GwL.Kv4@world.std.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <Do4GwL.Kv4@world.std.com> klanza@world.std.com "Kurt J Lanza" writes:
-
- >># define A "hello world!"
-
- >What did the compiler say? Something about invalid type, I
- >wouls suspect. You have defined A as a character pointer.
-
- A (or rather the "hello world!" which is substitued for A) has type
- "array of 13 char". It is not a char *, for example sizeof(A) is 13 and
- is unlikely to equal sizeof(char *) on any reasonable platform.
-
- >> c = A; (1)
-
- Here A is in a context where a value is required (the right hand operand of
- = ). When you take the value of an array you get a pointer to its first
- element so it is true that this is attempting to assign a value with type
- char * to c. However A itself is not a char * and particularly not in the
- context of its definition.
-
- >(1) You can't assign a character pointer to an integer.
-
- That is indeed the problem.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-